<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function Person(name, age, gender) {
				this.name = name;
				this.age = age;
				this.gender = gender;
			}

			var per = new Person("aa", 18, "男");
			var result = per.toString();
			// 当我们直接在页面中打印一个对象时，事件上是输出对象toString()方法的返回值
			console.log(result)
			console.log(per.__proto__.__proto__.hasOwnProperty("toString"))
			// 如果希望在输出对象时不输出[object Object],可以为对象添加一个toString方法
			var per2 = new Person("aa", 18, "男");
			Person.prototype.toString = function(){
				return "Person[name ="+this.name+"age="+this.age+"gender="+this.gender+"]"
			}
			console.log(per2.toString())
		</script>
	</head>
	<body>
	</body>
</html>
